home *** CD-ROM | disk | FTP | other *** search
-
- XDEF NumToStr
-
- ; Args:
- ; A0 Pointer to space for the converted ASCII number. (11 bytes)
- ; D0 32 bit number to convert.
-
- ; Returns:
- ; A0 Pointer to a ASCII number string.
- ; D0 Length of the string.
-
- ; A1 & D1 will be trashed.
-
- MACHINE 68020
-
- NumToStr:
- movem.l d2,-(sp)
- add.l #10,a0
- clr.b (a0) ; Clear the last byte of the string
- subq.l #1,a0
- moveq #0,d2
-
- NumToStr1:
- moveq #0,d1
- divu.l #10,d1:d0
- move.b d1,(a0)
- add.b #"0",(a0)
- addq.w #1,d2
- tst.l d0
- beq N2A_Finished
- subq.l #1,a0
- bra NumToStr1
-
- N2A_Finished:
- move.l d2,d0
- movem.l (sp)+,d2
- rts
-